package com.ettractions.kiosk.components
{
	import flash.events.Event;
	import flash.events.ProgressEvent;
	
	import mx.preloaders.SparkDownloadProgressBar;
	
	public class Preloader extends SparkDownloadProgressBar
	{
		private var _loadingScreen:LoadingScreen;
		
		public function Preloader()
		{
			super();
		}
		
		override protected function initProgressHandler(event:Event):void
		{
			if (!_loadingScreen)
			{
				_loadingScreen = LoadingScreen(stage.addChild(new LoadingScreen()));
				_loadingScreen.appendText("Initializing application... ");
			}
		}
		
		override protected function initCompleteHandler(event:Event):void
		{
			_loadingScreen.appendText("done.\n");
			
			dispatchEvent(new Event(Event.COMPLETE));
		}
	}
}